import 'package:boss/ui/widget/button/fixed_bottom_btn.dart';
import 'package:boss/ui/widget/calendar/provider/calendar_provider.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'calendar_body.dart';
import 'calendar_header.dart';
import 'calendar_title_bar.dart';

class CalendarBrowser extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        CalendarTitleBar(),
        CalendarHeader(),
        CalendarBody(),
        FixedBottomBtn(
          title: '保 存',
          isShowShadow: false,
          onTap: () {
            var provider = Provider.of<CalendarProvider>(
              context,
              listen: false,
            );
            if (provider.startDateTime == null) {
              toast('请选择日期');
              return;
            }
            Navigator.pop(
              context,
              [provider.startDateTime, provider.endDateTime ?? provider.startDateTime],
            );
          },
        ),
      ],
    );
  }
}
